package fox.framework.rpc.client.message;

import fox.framework.rpc.client.message.request.RpcClientRequest;
import fox.framework.rpc.message.RpcHeader;

import java.util.UUID;

/**
 * @author cuichao
 * @Description: FoxRequestInterceptor
 * @Date: create in 2021/2/21 20:44
 */
public class FoxRequestInterceptor implements RpcClientRequestInterceptor {

    private final String PROTOCOL = "fox";

    @Override
    public void intercept(RpcClientRequest request) throws Exception {
        if(PROTOCOL.equals(request.getProtocol())){
            request.setHeader(RpcHeader.REQUEST_ID,UUID.randomUUID().toString());
        }
    }
}
